{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "490d30bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0559a3a3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c7954d53",
   "metadata": {},
   "outputs": [],
   "source": [
    "files = list(filter(lambda item: item.startswith(\"全国\"), os.listdir(\"./\")))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "ccad3ab7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['全国交易.csv_中国邮政集团公司福建省分公司',\n",
       " '全国交易.csv_中国邮政集团有限公司安徽省分公司',\n",
       " '全国交易.csv_北京邮政',\n",
       " '全国交易.csv_宁夏邮政',\n",
       " '全国交易.csv_山东邮政',\n",
       " '全国交易.csv_山西邮政',\n",
       " '全国交易.csv_广东邮政',\n",
       " '全国交易.csv_广西邮政',\n",
       " '全国交易.csv_新疆邮政',\n",
       " '全国交易.csv_江苏邮政',\n",
       " '全国交易.csv_河北邮政',\n",
       " '全国交易.csv_河南邮政',\n",
       " '全国交易.csv_浙江邮政公司',\n",
       " '全国交易.csv_海南邮政',\n",
       " '全国交易.csv_湖南邮政',\n",
       " '全国交易.csv_甘肃邮政',\n",
       " '全国交易.csv_陕西邮政',\n",
       " '全国交易.csv_黑龙江邮政']"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "files"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "4f53b2cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.concat(list(map(lambda file: pd.read_csv(file, encoding=\"utf-8\"), files)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "1df41c4e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 6216429 entries, 0 to 113222\n",
      "Data columns (total 6 columns):\n",
      " #   Column                    Dtype  \n",
      "---  ------                    -----  \n",
      " 0   proxy_id                  int64  \n",
      " 1   member_id                 int64  \n",
      " 2   salesman_id               int64  \n",
      " 3   从20210101到20220101的交易金额   float64\n",
      " 4   从20210101到20220101的交易笔数   float64\n",
      " 5   从20210101到20220101的交易手续费  float64\n",
      "dtypes: float64(3), int64(3)\n",
      "memory usage: 332.0 MB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5780dfa2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "463876540095.0204"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[\"从20210101到20220101的交易金额\"].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "040d4d69",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3788641739.0"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[\"从20210101到20220101的交易笔数\"].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ebfe74a8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
